package indi.a709924470.scpwiki;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.support.v7.widget.Toolbar;

public class webView extends AppCompatActivity {

    public String htm = "";

    public webView(){
        this.htm = "";
    }

    public webView(String url){
        this.htm = url;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web_view);

        //getActionBar().setDisplayHomeAsUpEnabled(true);

        //setSupportActionBar((Toolbar) findViewById(R.id.tBar));

        String url = getIntent().getStringExtra("Url");
        ParseWikiPage pwp = new ParseWikiPage(url);
        htm = pwp.parseContent();
        setTitle(pwp.getTitle());

        WebView wv = (WebView) findViewById(R.id.wikiWebView);
        wv.getSettings().setDefaultTextEncodingName(pwp.getCharset());
        wv.loadData(htm,"text/html; charset="+pwp.getCharset(),null);
        wv.reload();
    }
}
